﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Chess.Common.Network;
using Chess.Common.Network.Packets;

namespace Chess.Server
{
    public static class Handler
    {
        public static void Handle(Session session, NetworkData data)
        {
            switch (data.Id.ToString())
            {
                case "handshake":
                    HandshakePacket handshake = (HandshakePacket)data;
                    if (handshake.Version.Equals(Globals.Version))
                    {
                        session.Write(new SuccessPacket());
                    }
                    else
                    {
                        session.Write(new ErrorPacket(ErrorType.InvalidVersion, ""));
                    }
                    break;
            }
        }
    }
}
